package mobi.greenplate.theweb.converter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import mobi.greenplate.theweb.domain.RequestRide;


@XmlRootElement(name="requestRide-list")
public class RequestRideListConverter {

    private final List<RequestRide> entities;

    public RequestRideListConverter() {
        this.entities=new ArrayList<RequestRide>();
    }
    
    public RequestRideListConverter(List<RequestRide> entities) {
        this.entities = entities;
    }

    @XmlElement
    public List<RequestRideConverter> getRequestRide(){
        final List<RequestRideConverter> list = new ArrayList<RequestRideConverter>();
        for (RequestRide requestRide : entities) {
            list.add(new RequestRideConverter(requestRide));
        }
        return list;
    }

    @XmlTransient
    public List<RequestRide> getEntities(){
        return Collections.unmodifiableList(this.entities);
    }

}


